{% load staticfiles %}
{% csrf_token %}
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="stylesheet" href="{% static 'css/layui.css' %}">
        <link rel="stylesheet" href="{% static 'css/index.css' %}">
        <title>编写yaml</title>
    </head>
    <body style="height: 100%;">
        <div id="key_left" class="layui-keys-left">
            <div><a style="font-size: 20px;"><i class="layui-icon" style="font-size: 20px;">&#xe60a;</i>密钥列表</a><hr class="layui-bg-green" style="margin: 8px 18px 0 0 "></div>
            <table class="layui-table" id="key_list" lay-filter="key_list"></table>
        </div>
        <div id="key_right" class="layui-keys-right">
            <form id="formhost" name="formhost" class="layui-form layui-form-pane">
                <div style="margin: 5px 0 0 0;"><a style="font-size: 20px;"><i class="layui-icon" style="font-size: 20px;">&#xe658;</i>增加公私钥配置</a></div>
                <hr class="layui-bg-green" style="margin: 3px 3px 20px 3px;">
                <div class="layui-form-item layui-form-item-hosts">
                    <label class="layui-form-label">名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="keyname" required lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input">
                    </div>
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-inline" style="width:140px;">
                        <input type="password" name="keypwd" required lay-verify="required" autocomplete="off" placeholder="请输入密码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-item-hosts">
                    <label class="layui-form-label">密钥描述</label>
                    <div class="layui-input-block">
                        <input type="text" name="keyms" autocomplete="off" placeholder="请输入" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text layui-form-item-hosts">
                        <label class="layui-form-label">公钥</label>
                        <div class="layui-input-block">
                            <textarea name="publickey" placeholder="请输入公钥" required lay-verify="required" class="layui-textarea"></textarea>
                        </div>
                </div>
                <div class="layui-form-item layui-form-text layui-form-item-hosts">
                    <label class="layui-form-label">密钥</label>
                    <div class="layui-input-block">
                        <textarea name="privatekey" placeholder="请输入密钥" required lay-verify="required" class="layui-textarea" style="height: 140px;"></textarea>
                    </div>
                </div>
                <div class="layui-form-item layui-form-item-hosts">
                    <div class="layui-input-block" style="margin-left: 220px;">
                        <button type="button" id="submitkey" class="layui-btn" lay-submit lay-filter="submitkey">提交</button>
                        <button id="resets" type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </body>
    <script src="{% static 'layui.all.js' %}"></script>
    <script>
        var keys_list = {{ keys_list|safe }};
    </script>
    <script type="text/html" id="keysDemo">
            <a class="layui-btn layui-btn-xs" lay-event="check">查看</a>
            {% verbatim myblock %}
                {{#  if(d.key_using == 0){ }}
                    <a id="disable" class="layui-btn layui-btn-xs layui-btn-disable" lay-event="disable">禁用</a>
                {{#  } else { }}
                    <a id="enable" class="layui-btn layui-btn-xs layui-btn-enable" lay-event="enable">启用</a>
                {{#  } }}
            {% endverbatim myblock %}
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script type="text/html" id="keystatus">
        {% verbatim myblock %}
            {{#  if(d.key_using == 0){ }}
                <span class="label label-success">已启用</span>
            {{#  } else { }}
                <span class="label label-default">已禁用</span>
            {{#  } }}
        {% endverbatim myblock %}
    </script>
    <script src="{% static 'js/automation/yamlkeys.js' %}"></script>
</html>